<?php

namespace app\server;

class rewardServer
{

    public function getReward($user,$params){
        $coins = 100;
        if($user['ymd'] == date('Ymd')){
            if($user['total_coins'] === 0){
                $coins = 1000;
            }else{
                $coins = mt_rand(300,500);
            }
        }else{
            $coins = mt_rand(300,500);
            if($user['total_coins'] > 140000){
                $coins = 1;
            }
        }
        $row = [
            'uuid'=>$user['uuid'],
            'reward_id'=>substr(md5(time().mt_rand(0,999999)), -16),
            'coins'=>$coins
        ];
        add('app_ad_reward',$row);
        return $row;
   }


}
?>
